package com.qd.common.panda.domain.entity.carpark;

import com.qd.common.panda.domain.entity.stroke.HistoryStrokeVO;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;
import java.util.Optional;

/**
 * 用户进入停车场详情界面
 *
 * @author sjk
 */
@Data
@Accessors(chain = true)
public class PersonCarPark {
    /**
     * 停车场信息
     */
    private CarParkInfoDTO carParkInfo;
    /**
     * 停车场平均分
     */
    private String carParkAvgScore;
    /**
     * 停车场最后一条评价
     */
    private String evaluateContent;
    /**
     * 收藏状态 0否 1是
     */
    private Integer collect;
    /**
     * 收藏ID
     */
    private String collectId;
    /**
     * 车牌号
     */
    private String plateNumber;
    /**
     * 预约信息
     */
    private CarParkAppointmentSetDTO appointmentSet;
    /**
     * 停车场介绍图片
     */
    private List<CarParkImgDTO> imgList;
    /**
     * 行程历史记录,最后一条
     */
    private HistoryStrokeVO historyStroke;
    /**
     * 是否开启积分抵扣
     */
    private String pointDeduction;

    public void freeData() {
        Optional.ofNullable(carParkInfo).ifPresent(CarParkInfoDTO::freeData);
        Optional.ofNullable(historyStroke).ifPresent(HistoryStrokeVO::freeData);
        this.carParkAvgScore = null;
        this.collect = null;
        this.plateNumber = null;
        this.evaluateContent = null;
        this.pointDeduction = null;
        Optional.ofNullable(appointmentSet).ifPresent(CarParkAppointmentSetDTO::freeData);
        Optional.ofNullable(imgList).ifPresent(List::clear);
    }
}